package cc.owoo.godpen.reflect;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * 函数值获取
 * Created by nimensei
 * 2022-05-16 上午 10:25
 **/
public record MethodGet(Method method) implements ValueGet {
    @Override
    public Object get(Object object) throws IllegalAccessException, InvocationTargetException {
        if (object == null)
            return null;
        return method.invoke(object);
    }
}
